$.fn.extend({

    dialog:function(params){
        var obj={title:'默认标题',btnValue:'确定',btnBind:null};
        for(var prop in obj){
            obj[prop]=params[prop]||obj[prop];
        }

        if(typeof(params)=="object"){
            var html='<div class="modal fade">\
            <div class="modal-dialog">\
                <div class="modal-content">\
                <div class="modal-header">\
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>\
            <h4 class="modal-title"></h4>\
                </div>\
                <div class="modal-body">\
                </div>\
                <div class="modal-footer">\
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>\
                <button type="button" class="btn btn-primary">确定</button>\
                </div>\
                </div>\
                </div>\
                </div>';
           var $modal=$(html);
            $modal.find(".modal-title").html(obj.title);
            this.children("*").appendTo($modal.find(".modal-body"));
            $modal.find(":button:last").html(obj.btnValue);
            $modal.find(":button:last").off("click").on("click",obj.btnBind);
            $modal.appendTo(this);
        }else if("open"==params){
           this.find(".modal").modal("show");
        }else if("close"==params){
            this.find(".modal").modal("hide");
        }




    }


});